Skip to content

Conversation

@mkantor
Copy link
Owner

@mkantor mkantor commented May 14, 2025

Any keyword expression can now be written using the following syntax sugar:

@keyword { … }

This is especially helpful for @if, which felt quite awkward.

Previously, you'd write this:

{
  @if
  condition: …
  then: …
  else: …
}

Now, it's this:

@if {
  condition: …
  then: …
  else: …
}

(Keys are optional, as they were before.)

mkantor added 5 commits May 14, 2025 12:09
Previously arguments were additional properties at the top level of the
keyword expression object (siblings of the `0` property). Now they are
packed into a single property value keyed by `1`.

This brings keyword expressions semantics closer to function semantics
(both now have a single argument), and will help make the upcoming
generalized keyword expression syntax sugar more sensible.
This carves out syntax space for a planned generalized keyword
expression sugar (`@` will become relevant to parsing).
@mkantor mkantor force-pushed the generalized-keyword-expression-sugar branch from fbdcc31 to 7fef85a Compare May 15, 2025 11:34
@mkantor mkantor merged commit f57a3ed into main May 15, 2025
1 check passed
@mkantor mkantor deleted the generalized-keyword-expression-sugar branch May 15, 2025 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants